String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

Ajax.Validator = Class.create();
Object.extend(Object.extend(Ajax.Validator.prototype, Ajax.Request.prototype), {
  resultText : null,

  initialize: function(url){
    this.transport = Ajax.getTransport();
    this.setOptions({asynchronous: false});
    this.options.onComplete = (function(transport) {
      this.evalResult();
    }).bind(this);
    this.request(url);
  },

  evalResult: function() {
    this.resultText = this.transport.responseText;
  },

  getResult: function() {
    return this.resultText;
  }
});

Ajax.InPlaceEditor.prototype.__onComplete = Ajax.InPlaceEditor.prototype.onComplete;
Ajax.InPlaceEditor.prototype.__createForm = Ajax.InPlaceEditor.prototype.createForm;
Ajax.InPlaceEditorAutoCompletable = Class.create();
Ajax.InPlaceEditorAutoCompletable.defaultHighlightColor = Ajax.InPlaceEditor.defaultHighlightColor;
Object.extend(Ajax.InPlaceEditorAutoCompletable.prototype, Ajax.InPlaceEditor.prototype);
Object.extend(Ajax.InPlaceEditorAutoCompletable.prototype, {
  createForm: function(){
    this.__createForm();
    if(this.options.div_ac){
      new Ajax.Autocompleter(this.editField, this.options.div_ac, this.options.url_ac, {minChars: this.options.minChars, paramName: this.options.paramName});
    }
  },

  onComplete: function(transport){
    this.__onComplete(transport);
    if(this.options.div_ac){
      $(this.options.div_ac).style.display = 'none';
      }
  }
});

Ajax.InPlaceCollectionEditor.prototype.__createEditField = Ajax.InPlaceCollectionEditor.prototype.createEditField;
Ajax.InPlaceCollectionEditor.prototype = Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
  createEditField: function() {
    if (this.options.callback) { var callbackSet = this.options.callback };
      this.__createEditField();
      if (callbackSet) {
        this.options.callback = callbackSet;
      };
  }
});